#include "gShip.h"

gShip::gShip()
{
	m_weaponPri = 0;
	m_weaponSec = 0;
}

gShip::~gShip()
{
	if(m_weaponPri)
	{
		m_weaponPri->release();
		delete m_weaponPri;
	}

	if(m_weaponSec)
	{
		m_weaponSec->release();
		delete m_weaponSec;
	}
}

void gShip::initShip(gEnergy a_energy)
{
	m_energy = a_energy;
}

void gShip::initWeaponPri(gWeapon* a_weapon)
{
	m_weaponPri = a_weapon;
}

void gShip::initWeaponSec(gWeapon* a_weapon)
{
	m_weaponSec = a_weapon;
}

void gShip::input()
{
	if(m_weaponPri) m_weaponPri->input();
	if(m_weaponSec) m_weaponSec->input();
}

void gShip::update()
{
	gObject::update();

	if(m_weaponPri) m_weaponPri->update();
	if(m_weaponSec) m_weaponSec->update();
}

void gShip::draw()
{
	if(m_weaponPri) m_weaponPri->draw();
	if(m_weaponSec) m_weaponSec->draw();

	gObject::draw();
}